package com.oepm.biz.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.oepm.biz.ExcelBiz;
import com.oepm.dao.entity.ExcelPo;
import com.oepm.dao.entity.QueryInfo;
import com.oepm.dao.mapper.ExcelMapper;
import com.oepm.vo.DataVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ExcelBizImpl implements ExcelBiz {
    @Resource
    ExcelMapper excelMapper;
    @Override
    public DataVo<ExcelPo> selectAll(QueryInfo queryInfo) {
        PageHelper.startPage(queryInfo.getPagenum(),queryInfo.getPagesize());
        List<ExcelPo> list = excelMapper.selectAll();
        PageInfo<ExcelPo> result = new PageInfo<>(list);
        return new DataVo(result.getTotal(),result.getList());
    }

    @Override
    public DataVo<ExcelPo> selectByAcademy(QueryInfo queryInfo, String academy) {
        PageHelper.startPage(queryInfo.getPagenum(),queryInfo.getPagesize());
        List<ExcelPo> list = excelMapper.selectByAcademy(academy);
        PageInfo<ExcelPo> result = new PageInfo<>(list);
        return  new DataVo(result.getTotal(),result.getList());
    }
}
